Output Devices
On this page, I will be showing on how I used TinkerCAD to do up a circuit using a output device called the Neopixel LED strip.
Output Devices
Step 1
The first step is to connect the circuit to the picture below.
Step 2
The second step is to do up the code as to what is shown below.
#include#define PIN 12 #define NUMPIXELS 6 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 const int PSW = 5; int lastSWState; //last state of the SW void setup() { pixels.begin(); pinMode(PSW, INPUT); lastSWState = HIGH; //Switch state } void loop() { int reading = digitalRead(PSW); if (reading == LOW){ //swtich was pressed if (lastSWState == HIGH) { //confirm switch press pixels.clear(); pixels.setBrightness(10); pixels.setPixelColor(0, pixels.Color(255, 255, 255)); pixels.setPixelColor(1, pixels.Color(255, 0, 0)); pixels.setPixelColor(2, pixels.Color(0, 255, 0)); pixels.setPixelColor(3, pixels.Color(0, 0, 255)); pixels.setPixelColor(4, pixels.Color(255, 0, 255)); pixels.setPixelColor(5, pixels.Color(255, 255, 0)); pixels.setPixelColor(6, pixels.Color(0, 255, 255)); pixels.show(); lastSWState = LOW; } } else { //SW is not pressed lastSWState = HIGH; } }
Step 3
The third step is to test the code and the circuit and make sure it works. And you are done with the output devices.